//
//  WKNickNameController.m
//  WeKeTang
//
//  Created by ichina on 2017/9/7.
//  Copyright © 2017年 Dezhi Tiancheng Education Technology (Beijing) Co. Ltd. All rights reserved.
//

#import "WKNickNameController.h"

@interface WKNickNameController ()

@property (weak, nonatomic) IBOutlet UILabel *nickNameLabel;

@property (weak, nonatomic) IBOutlet UITextField *TFNickName;

@end

@implementation WKNickNameController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navItem.title = @"昵称";
    
    self.navgationBar.barTintColor = RGBColor(40, 188, 203);
    
    self.statusbar.backgroundColor = RGBColor(40, 188, 203);
    
    self.view.backgroundColor = RGBColor(245, 245, 245);
    
    [self setLeftButtonWithImage:@"icon_return_white" highlightedImage:@"icon_return_white" target:self action:@selector(backAction)];
    [self middleTitleColor:[UIColor whiteColor]];
    [self setRightButtonWithTittle:@"保存" color:[UIColor whiteColor] target:self action:@selector(saveNickNameAction)];
    
    [self setupUI];
    
}
- (void)setupUI{
    
//    self.TFNickName.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self.TFNickName setAutocorrectionType:UITextAutocorrectionTypeNo];
    [self.TFNickName setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    self.TFNickName.tintColor = RGBColor(40, 188, 203);
    UIView *leftView = [[UIView alloc] init];
    leftView.frame = CGRectMake(0, 0, 15, 0);
    self.TFNickName.leftView = leftView;
    self.TFNickName.leftViewMode = UITextFieldViewModeAlways;
    self.TFNickName.text = self.nickName;
}
#pragma mark - 保存昵称
- (void)saveNickNameAction{
    
    if (self.block) {
        
        self.block(self.TFNickName.text);
    }
    
    [self.navigationController popViewControllerAnimated:YES];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

@end
